// index.js
const app = getApp();
const { itinerary, tips } = require('../../utils/data.js');

Page({
  data: {
    travelInfo: {},
    itinerary: [],
    tips: [],
    currentDay: 1,
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 500,
    bannerImages: [
      '/images/banner1.jpg',
      '/images/banner2.jpg',
      '/images/banner3.jpg'
    ]
  },

  onLoad: function () {
    this.setData({
      travelInfo: app.globalData.travelInfo,
      itinerary: itinerary,
      tips: tips
    });
  },

  // 切换当前显示的行程日
  switchDay: function(e) {
    const day = parseInt(e.currentTarget.dataset.day);
    this.setData({
      currentDay: day
    });
  },

  // 跳转到地图页面
  navigateToMap: function() {
    wx.switchTab({
      url: '/pages/map/map'
    });
  },

  // 跳转到景点详情页面
  navigateToDetails: function() {
    wx.switchTab({
      url: '/pages/details/details'
    });
  },

  // 跳转到美食页面
  navigateToFood: function() {
    wx.switchTab({
      url: '/pages/food/food'
    });
  }
}) 